/**
 * @author 橘柚
 * @Date 2023/11/11 16:32
 * @Description
 */
import LayoutConfig from "@/config/layout-config.ts";
import {createSlice, PayloadAction} from "@reduxjs/toolkit";
import type {ILayoutConfig} from '@/config/layout-config.ts'
import type {Slice} from "@reduxjs/toolkit";

const initialState: ILayoutConfig = LayoutConfig

const layoutConfigSlice: Slice<ILayoutConfig> = createSlice({
  name: 'layoutConfig',
  initialState,
  reducers: {
    changeCollapsed: (state, action: PayloadAction<boolean>) => {
      state.collapsed = action.payload
    },
    changLang: (state, action: PayloadAction<string>) => {
      state.lang = action.payload
    }
  },
})
export const {changeCollapsed, changLang} = layoutConfigSlice.actions
export default layoutConfigSlice.reducer